﻿using CarterWechatServer.Util.Result;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http.Filters;

namespace CarterWechatServer.WebApi.App_Start.Filters
{
    //处理异常
    public class CustomExceptionFilterAttribute:ExceptionFilterAttribute
    {
        public override void OnException(HttpActionExecutedContext context)
        {
            context.Response = context.Request.CreateResponse(
                HttpStatusCode.OK,
                DataResult<string>.ForException(context.Exception));
        }
    }
}